<template>
  <el-dropdown
    plain
    type="single-number"
    placement="bottom"
    trigger="click"
    @command="batchOperate"
    style="margin-left: 10px"
  >
    <el-button class="search-btn" size="mini">
      其他费用项
      <i class="el-icon-arrow-down el-icon--right"></i>
    </el-button>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item command="贴息">贴息</el-dropdown-item>
      <el-dropdown-item command="价格追涨">价格追涨</el-dropdown-item>
      <el-dropdown-item command="价格追跌">价格追跌</el-dropdown-item>
      <el-dropdown-item command="其他">其他</el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown>
</template>

<script>
import { generateUUID } from "@/basa/utils";
export default {
  name: "otherDropdown",
  data() {
    return {
      qita: []
    };
  },
  methods: {
    batchOperate(data) {
      this.interest(data);
    },
    // 贴息
    interest(data) {
      if (
        this.qita.find(e => e.materialName == data && e.isOtherCost == 1) !=
        null
      ) {
        this.$message({
          type: "warning",
          message: "该类型已存在"
        });
        return;
      }
      var uuid = generateUUID();
      this.qita.push({
        mergeUuid: uuid,
        materialName: data,
        materialState: "",
        acceptNumber: "isOtherCost",
        isMerge: 0,
        isMainInventory: 0,
        isServices: 0,
        isOtherCost: 1,
        costName: data,
        costStatus: 1,
        acceptCount: null,
        settlementCount: "",
        unitPriceWithTax: "",
        moneyWithTax: null,
        isotherTest: true
        // taxRate: this.settlementForm.smpPcConc.multiRateCode
        //     ? this.settlementForm.smpPcConc.taxRate / 100
        //     : ""
      });
      // this.qita.push({
      //     mergeUuid: uuid,
      //     materialName: data,
      //     materialState: "",
      //     acceptNumber: "isOtherCost",
      //     isMerge: 0,
      //     isMainInventory: 0,
      //     isServices: 0,
      //     isOtherCost: 1,
      //     costName: data,
      //     costStatus: 1,
      //     acceptCount: null,
      //     settlementCount: "",
      //     unitPriceWithTax: "",
      //     moneyWithTax: null
      //     // taxRate: this.settlementForm.smpPcConc.multiRateCode
      //     //     ? this.settlementForm.smpPcConc.taxRate / 100
      //     //     : ""
      // });
      this.$emit("otherQita", this.qita);
    }
  }
};
</script>

<style scoped></style>
